<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="PasDoc 0.9.0">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>synachar</title>
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#FF0000">
<h1 class="unit">Unit synachar</h1>
<table class="sections">
<tr>
<td><a class="section"  href="#@Description">Description</a></td><td><a class="section"  href="#@Uses">uses</a></td><td>Classes, Interfaces, Objects and Records</td><td><a class="section"  href="#@FuncsProcs">Functions and Procedures</a></td><td><a class="section"  href="#@Types">Types</a></td><td><a class="section"  href="#@Constants">Constants</a></td><td><a class="section"  href="#@Variables">Variables</a></td></tr></table>
<a name="@Description"></a><h2 class="description">Description</h2>
<p>
Charset conversion support</p>
<p>
 This unit contains a routines for lot of charset conversions.

<p>It using built-in conversion tables or external Iconv library. Iconv is used when needed conversion is known by Iconv library. When Iconv library is not found or Iconv not know requested conversion, then are internal routines used for conversion. (You can disable Iconv support from your program too!)

<p>Internal routines knows all major charsets for Europe or America. For East-Asian charsets you must use Iconv library!</p>
<a name="@Uses"></a><h2 class="uses">uses</h2>
<ul class="useslist"><li>Windows</li><li>SysUtils</li><li><a   href="synautil.html">synautil</a></li><li><a   href="synacode.html">synacode</a></li><li><a   href="synaicnv.html">synaicnv</a></li></ul><h2 class="overview">Overview</h2>
<a name="@FuncsProcs"></a><h3 class="summary">Functions and Procedures</h3>
<table class="summary">
<tr class="list">
<td class="itemcode"><code>function <b><a   href="synachar.html#CharsetConversion">CharsetConversion</a></b>(const Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeChar">TMimeChar</a>): AnsiString;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="synachar.html#CharsetConversionEx">CharsetConversionEx</a></b>(const Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeChar">TMimeChar</a>; const TransformTable: array of Word): AnsiString;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="synachar.html#CharsetConversionTrans">CharsetConversionTrans</a></b>(Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeChar">TMimeChar</a>; const TransformTable: array of Word; Translit: Boolean): AnsiString;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="synachar.html#GetCurCP">GetCurCP</a></b>: <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="synachar.html#GetCurOEMCP">GetCurOEMCP</a></b>: <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="synachar.html#GetCPFromID">GetCPFromID</a></b>(Value: AnsiString): <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="synachar.html#GetIDFromCP">GetIDFromCP</a></b>(Value: <a   href="synachar.html#TMimeChar">TMimeChar</a>): AnsiString;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="synachar.html#NeedCharsetConversion">NeedCharsetConversion</a></b>(const Value: AnsiString): Boolean;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="synachar.html#IdealCharsetCoding">IdealCharsetCoding</a></b>(const Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeSetChar">TMimeSetChar</a>): <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="synachar.html#GetBOM">GetBOM</a></b>(Value: <a   href="synachar.html#TMimeChar">TMimeChar</a>): AnsiString;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="synachar.html#StringToWide">StringToWide</a></b>(const Value: AnsiString): WideString;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="synachar.html#WideToString">WideToString</a></b>(const Value: WideString): AnsiString;</code></td>
</tr>
</table>
<a name="@Types"></a><h3 class="summary">Types</h3>
<table class="summary">
<tr class="list">
<td class="itemcode"><code><b><a   href="synachar.html#TMimeChar">TMimeChar</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a   href="synachar.html#TMimeSetChar">TMimeSetChar</a></b> = set of <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
</table>
<a name="@Constants"></a><h3 class="summary">Constants</h3>
<table class="summary">
<tr class="list">
<td class="itemcode"><code><b><a   href="synachar.html#IconvOnlyChars">IconvOnlyChars</a></b>: set of <a   href="synachar.html#TMimeChar">TMimeChar</a> = [UTF_16, UTF_16LE, UTF_32, UTF_32LE,
    C99, JAVA, ISO_8859_16, KOI8_U, KOI8_RU, CP862, CP866, MAC, MACCE, MACICE,
    MACCRO, MACRO, MACCYR, MACUK, MACGR, MACTU, MACHEB, MACAR, MACTH, ROMAN8,
    NEXTSTEP, ARMASCII, GEORGIAN_AC, GEORGIAN_PS, KOI8_T, MULELAO, CP1133,
    TIS620, CP874, VISCII, TCVN, ISO_IR_14, JIS_X0201, JIS_X0208, JIS_X0212,
    GB1988_80, GB2312_80, ISO_IR_165, ISO_IR_149, EUC_JP, SHIFT_JIS, CP932,
    ISO_2022_JP, ISO_2022_JP1, ISO_2022_JP2, GB2312, CP936, GB18030,
    ISO_2022_CN, ISO_2022_CNE, HZ, EUC_TW, BIG5, CP950, BIG5_HKSCS, EUC_KR,
    CP949, CP1361, ISO_2022_KR, CP737, CP775, CP853, CP855, CP857, CP858,
    CP860, CP861, CP863, CP864, CP865, CP869, CP1125];</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a   href="synachar.html#NoIconvChars">NoIconvChars</a></b>: set of <a   href="synachar.html#TMimeChar">TMimeChar</a> = [CP895, UTF_7mod];</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a   href="synachar.html#Replace_None">Replace_None</a></b>: array[0..0] of Word =
    (0);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a   href="synachar.html#Replace_Czech">Replace_Czech</a></b>: array[0..59] of Word =
    (
      $00E1, $0061,
      $010D, $0063,
      $010F, $0064,
      $010E, $0044,
      $00E9, $0065,
      $011B, $0065,
      $00ED, $0069,
      $0148, $006E,
      $00F3, $006F,
      $0159, $0072,
      $0161, $0073,
      $0165, $0074,
      $00FA, $0075,
      $016F, $0075,
      $00FD, $0079,
      $017E, $007A,
      $00C1, $0041,
      $010C, $0043,
      $00C9, $0045,
      $011A, $0045,
      $00CD, $0049,
      $0147, $004E,
      $00D3, $004F,
      $0158, $0052,
      $0160, $0053,
      $0164, $0054,
      $00DA, $0055,
      $016E, $0055,
      $00DD, $0059,
      $017D, $005A
    );</code></td>
</tr>
</table>
<a name="@Variables"></a><h3 class="summary">Variables</h3>
<table class="summary">
<tr class="list">
<td class="itemcode"><code><b><a   href="synachar.html#DisableIconv">DisableIconv</a></b>: Boolean = False;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a   href="synachar.html#IdealCharsets">IdealCharsets</a></b>: <a   href="synachar.html#TMimeSetChar">TMimeSetChar</a> =
    [ISO_8859_1, ISO_8859_2, ISO_8859_3, ISO_8859_4, ISO_8859_5,
    ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, ISO_8859_10,
    KOI8_R, KOI8_U
     
    , GB2312, EUC_KR, ISO_2022_JP, EUC_TW
    
    ];</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Functions and Procedures</h3>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="CharsetConversion"></a><code>function <b>CharsetConversion</b>(const Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeChar">TMimeChar</a>): AnsiString;</code></td>
</tr>
</table>
<p>
Convert Value from one charset to another. See: <a class="normal" href="synachar.html#CharsetConversionEx">CharsetConversionEx</a></p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="CharsetConversionEx"></a><code>function <b>CharsetConversionEx</b>(const Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeChar">TMimeChar</a>; const TransformTable: array of Word): AnsiString;</code></td>
</tr>
</table>
<p>
Convert Value from one charset to another with additional character conversion. see: <a class="normal" href="synachar.html#Replace_None">Replace_None</a> and <a class="normal" href="synachar.html#Replace_Czech">Replace_Czech</a></p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="CharsetConversionTrans"></a><code>function <b>CharsetConversionTrans</b>(Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeChar">TMimeChar</a>; const TransformTable: array of Word; Translit: Boolean): AnsiString;</code></td>
</tr>
</table>
<p>
Convert Value from one charset to another with additional character conversion. This funtion is similar to <a class="normal" href="synachar.html#CharsetConversionEx">CharsetConversionEx</a>, but you can disable transliteration of unconvertible characters.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="GetCurCP"></a><code>function <b>GetCurCP</b>: <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
</table>
<p>
Returns charset used by operating system.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="GetCurOEMCP"></a><code>function <b>GetCurOEMCP</b>: <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
</table>
<p>
Returns charset used by operating system as OEM charset. (in Windows DOS box, for example)</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="GetCPFromID"></a><code>function <b>GetCPFromID</b>(Value: AnsiString): <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
</table>
<p>
Converting string with charset name to TMimeChar.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="GetIDFromCP"></a><code>function <b>GetIDFromCP</b>(Value: <a   href="synachar.html#TMimeChar">TMimeChar</a>): AnsiString;</code></td>
</tr>
</table>
<p>
Converting TMimeChar to string with name of charset.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="NeedCharsetConversion"></a><code>function <b>NeedCharsetConversion</b>(const Value: AnsiString): Boolean;</code></td>
</tr>
</table>
<p>
return <code>True</code> when value need to be converted. (It is not 7-bit ASCII)</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="IdealCharsetCoding"></a><code>function <b>IdealCharsetCoding</b>(const Value: AnsiString; CharFrom: <a   href="synachar.html#TMimeChar">TMimeChar</a>; CharTo: <a   href="synachar.html#TMimeSetChar">TMimeSetChar</a>): <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
</table>
<p>
Finding best target charset from set of TMimeChars with minimal count of unconvertible characters.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="GetBOM"></a><code>function <b>GetBOM</b>(Value: <a   href="synachar.html#TMimeChar">TMimeChar</a>): AnsiString;</code></td>
</tr>
</table>
<p>
Return BOM (Byte Order Mark) for given unicode charset.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="StringToWide"></a><code>function <b>StringToWide</b>(const Value: AnsiString): WideString;</code></td>
</tr>
</table>
<p>
Convert binary string with unicode content to WideString.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="WideToString"></a><code>function <b>WideToString</b>(const Value: WideString): AnsiString;</code></td>
</tr>
</table>
<p>
Convert WideString to binary string with unicode content.</p>
<h3 class="detail">Types</h3>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="TMimeChar"></a><code><b>TMimeChar</b> = (...);</code></td>
</tr>
</table>
<p>
Type with all supported charsets.</p>
<ul>
<li>
ISO_8859_1: </li>
<li>
ISO_8859_2: </li>
<li>
ISO_8859_3: </li>
<li>
ISO_8859_4: </li>
<li>
ISO_8859_5: </li>
<li>
ISO_8859_6: </li>
<li>
ISO_8859_7: </li>
<li>
ISO_8859_8: </li>
<li>
ISO_8859_9: </li>
<li>
ISO_8859_10: </li>
<li>
ISO_8859_13: </li>
<li>
ISO_8859_14: </li>
<li>
ISO_8859_15: </li>
<li>
CP1250: </li>
<li>
CP1251: </li>
<li>
CP1252: </li>
<li>
CP1253: </li>
<li>
CP1254: </li>
<li>
CP1255: </li>
<li>
CP1256: </li>
<li>
CP1257: </li>
<li>
CP1258: </li>
<li>
KOI8_R: </li>
<li>
CP895: </li>
<li>
CP852: </li>
<li>
UCS_2: </li>
<li>
UCS_4: </li>
<li>
UTF_8: </li>
<li>
UTF_7: </li>
<li>
UTF_7mod: </li>
<li>
UCS_2LE: </li>
<li>
UCS_4LE: </li>
<li>
UTF_16: </li>
<li>
UTF_16LE: </li>
<li>
UTF_32: </li>
<li>
UTF_32LE: </li>
<li>
C99: </li>
<li>
JAVA: </li>
<li>
ISO_8859_16: </li>
<li>
KOI8_U: </li>
<li>
KOI8_RU: </li>
<li>
CP862: </li>
<li>
CP866: </li>
<li>
MAC: </li>
<li>
MACCE: </li>
<li>
MACICE: </li>
<li>
MACCRO: </li>
<li>
MACRO: </li>
<li>
MACCYR: </li>
<li>
MACUK: </li>
<li>
MACGR: </li>
<li>
MACTU: </li>
<li>
MACHEB: </li>
<li>
MACAR: </li>
<li>
MACTH: </li>
<li>
ROMAN8: </li>
<li>
NEXTSTEP: </li>
<li>
ARMASCII: </li>
<li>
GEORGIAN_AC: </li>
<li>
GEORGIAN_PS: </li>
<li>
KOI8_T: </li>
<li>
MULELAO: </li>
<li>
CP1133: </li>
<li>
TIS620: </li>
<li>
CP874: </li>
<li>
VISCII: </li>
<li>
TCVN: </li>
<li>
ISO_IR_14: </li>
<li>
JIS_X0201: </li>
<li>
JIS_X0208: </li>
<li>
JIS_X0212: </li>
<li>
GB1988_80: </li>
<li>
GB2312_80: </li>
<li>
ISO_IR_165: </li>
<li>
ISO_IR_149: </li>
<li>
EUC_JP: </li>
<li>
SHIFT_JIS: </li>
<li>
CP932: </li>
<li>
ISO_2022_JP: </li>
<li>
ISO_2022_JP1: </li>
<li>
ISO_2022_JP2: </li>
<li>
GB2312: </li>
<li>
CP936: </li>
<li>
GB18030: </li>
<li>
ISO_2022_CN: </li>
<li>
ISO_2022_CNE: </li>
<li>
HZ: </li>
<li>
EUC_TW: </li>
<li>
BIG5: </li>
<li>
CP950: </li>
<li>
BIG5_HKSCS: </li>
<li>
EUC_KR: </li>
<li>
CP949: </li>
<li>
CP1361: </li>
<li>
ISO_2022_KR: </li>
<li>
CP737: </li>
<li>
CP775: </li>
<li>
CP853: </li>
<li>
CP855: </li>
<li>
CP857: </li>
<li>
CP858: </li>
<li>
CP860: </li>
<li>
CP861: </li>
<li>
CP863: </li>
<li>
CP864: </li>
<li>
CP865: </li>
<li>
CP869: </li>
<li>
CP1125: </li>
</ul>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="TMimeSetChar"></a><code><b>TMimeSetChar</b> = set of <a   href="synachar.html#TMimeChar">TMimeChar</a>;</code></td>
</tr>
</table>
<p>
Set of any charsets.</p>
<h3 class="detail">Constants</h3>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="IconvOnlyChars"></a><code><b>IconvOnlyChars</b>: set of <a   href="synachar.html#TMimeChar">TMimeChar</a> = [UTF_16, UTF_16LE, UTF_32, UTF_32LE,
    C99, JAVA, ISO_8859_16, KOI8_U, KOI8_RU, CP862, CP866, MAC, MACCE, MACICE,
    MACCRO, MACRO, MACCYR, MACUK, MACGR, MACTU, MACHEB, MACAR, MACTH, ROMAN8,
    NEXTSTEP, ARMASCII, GEORGIAN_AC, GEORGIAN_PS, KOI8_T, MULELAO, CP1133,
    TIS620, CP874, VISCII, TCVN, ISO_IR_14, JIS_X0201, JIS_X0208, JIS_X0212,
    GB1988_80, GB2312_80, ISO_IR_165, ISO_IR_149, EUC_JP, SHIFT_JIS, CP932,
    ISO_2022_JP, ISO_2022_JP1, ISO_2022_JP2, GB2312, CP936, GB18030,
    ISO_2022_CN, ISO_2022_CNE, HZ, EUC_TW, BIG5, CP950, BIG5_HKSCS, EUC_KR,
    CP949, CP1361, ISO_2022_KR, CP737, CP775, CP853, CP855, CP857, CP858,
    CP860, CP861, CP863, CP864, CP865, CP869, CP1125];</code></td>
</tr>
</table>
<p>
Set of charsets supported by Iconv library only.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="NoIconvChars"></a><code><b>NoIconvChars</b>: set of <a   href="synachar.html#TMimeChar">TMimeChar</a> = [CP895, UTF_7mod];</code></td>
</tr>
</table>
<p>
Set of charsets supported by internal routines only.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="Replace_None"></a><code><b>Replace_None</b>: array[0..0] of Word =
    (0);</code></td>
</tr>
</table>
<p>
null character replace table. (Usable for disable charater replacing.)</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="Replace_Czech"></a><code><b>Replace_Czech</b>: array[0..59] of Word =
    (
      $00E1, $0061,
      $010D, $0063,
      $010F, $0064,
      $010E, $0044,
      $00E9, $0065,
      $011B, $0065,
      $00ED, $0069,
      $0148, $006E,
      $00F3, $006F,
      $0159, $0072,
      $0161, $0073,
      $0165, $0074,
      $00FA, $0075,
      $016F, $0075,
      $00FD, $0079,
      $017E, $007A,
      $00C1, $0041,
      $010C, $0043,
      $00C9, $0045,
      $011A, $0045,
      $00CD, $0049,
      $0147, $004E,
      $00D3, $004F,
      $0158, $0052,
      $0160, $0053,
      $0164, $0054,
      $00DA, $0055,
      $016E, $0055,
      $00DD, $0059,
      $017D, $005A
    );</code></td>
</tr>
</table>
<p>
Character replace table for remove Czech diakritics.</p>
<h3 class="detail">Variables</h3>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="DisableIconv"></a><code><b>DisableIconv</b>: Boolean = False;</code></td>
</tr>
</table>
<p>
By this you can generally disable/enable Iconv support.</p>
<table class="detail">
<tr class="list">
<td class="itemcode"><a name="IdealCharsets"></a><code><b>IdealCharsets</b>: <a   href="synachar.html#TMimeSetChar">TMimeSetChar</a> =
    [ISO_8859_1, ISO_8859_2, ISO_8859_3, ISO_8859_4, ISO_8859_5,
    ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, ISO_8859_10,
    KOI8_R, KOI8_U
     
    , GB2312, EUC_KR, ISO_2022_JP, EUC_TW
    
    ];</code></td>
</tr>
</table>
<p>
Default set of charsets for <a class="normal" href="synachar.html#IdealCharsetCoding">IdealCharsetCoding</a> function.</p>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a  target="_parent" href="http://pasdoc.sourceforge.net/">PasDoc 0.9.0</a> on 2012-04-23 21:38:52</em>
</span>
</body></html>
